<template>
    <div>
        <h3>组件freezeCom</h3>
        <div>object1--age--{{ object1.age }}</div>
        <button @click="change">修改年龄</button>
    </div>
</template>

<script setup>
import { ref } from 'vue';
const object1 = ref({
    name: '长江二桥',
    age: 18
})
// Object.freeze() 方法用于冻结对象，使其属性不可修改
// console.log(object1.value.age);
Object.freeze(object1.value)
const change = () => {
    object1.value.age = 22
    console.log(object1.value.age);
}
</script>

<style lang="scss" scoped></style>